<!DOCTYPE html>
<html>
<head>
<script src="/js-test-resources/ahem.js"></script>
<script>
    window.onload = function() {
        // fetch offsetTop to force a layout
        document.body.offsetTop;

        var el = document.querySelector('#add-shape-image-threshold .shape');
        el.style.setProperty('shape-image-threshold', 0.25);
        el.className = 'shape threshold25';

        el = document.querySelector('#change-shape-image-threshold .shape');
        el.className = 'shape threshold75';

        el = document.querySelector('#remove-shape-image-threshold .shape');
        el.className = 'shape';
    };
</script>
<style>
    .container {
        width: 200px;
        height: 200px;
        overflow-wrap: break-word;
        border: 2px solid blue;
        font: 50px/1 Ahem, sans-serif;
        color: green;
        overflow: hidden;
    }
    .shape {
        float: left;
        position: relative;
        width: 100px;
        height: 100px;
        shape-outside: url('../resources/svg-shape-002.svg');
    }
    .shape::before {
        position: absolute;
        display: block;
        top: 0; left: 0;
        width: 100px;
        height: 100px;
        background-color: blue;
        content: ' ';
    }

    .threshold25 {
        shape-image-threshold: 0.26;
    }
    .threshold25::before {
        width: 75px;
    }

    .threshold75 {
        shape-image-threshold: 0.76;
    }
    .threshold75::before {
        width: 25px;
    }
</style>
</head>
<body>
    <p>When shape-image-threshold is modified dynamically, content affected by the shape's contour should relayout. For each test, you should see green blocks separated by white space, wrapping around a blue rectangle in the upper left. This test requires the Ahem font.</p>

    <p>Setting shape-image-threshold with no prior entry</p>
    <div id='add-shape-image-threshold' class='container'><div class='shape'></div>x x x x x x x x x x</div>

    <p>Setting shape-image-threshold with a prior entry</p>
    <div id='change-shape-image-threshold' class='container'><div class='shape threshold25'></div>x x x x x x x x x x</div>

    <p>Removing shape-image-threshold with a prior entry</p>
    <div id='remove-shape-image-threshold' class='container'><div class='shape threshold25'></div>x x x x x x x x x x</div>
</body>
</html>
